package com.xiake.controller;

import com.xiake.mapper.HeadlineMapper;
import com.xiake.pojo.Type;
import com.xiake.pojo.User;
import com.xiake.pojo.vo.PortalVo;
import com.xiake.service.HeadlineService;
import com.xiake.service.TypeService;
import com.xiake.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("portal")
@CrossOrigin
public class PortalController {
    @Autowired
    TypeService typeService;

    @Autowired
    HeadlineService headlineService;
    @GetMapping("findAllTypes")
    public Result<Type> findAllTypes(){
       Result result=typeService.findAllTypes();
       return result;
    }

    @PostMapping("findNewsPage")
    public Result findNewPage(@RequestBody PortalVo portalVo){
        Result result=headlineService.findNewPage(portalVo);
        return result;
    }

    @PostMapping("showHeadlineDetail")
    public Result showHeadlineDetail( Integer hid){     //根据参数接值
        Result result= headlineService.showHeadlineDetail(hid);
        return result;
    }
}
